Make trivially_copy_pass_by_ref
conditional on a 64-bit target.
#77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consider the following code:
When targeting 64-bit
Foo
is 24 bytes and so doesn't triggertrivially_copy_pass_by_ref
fortake_foo
.However when targeting 32-bit
Foo
is 12 bytes, which is below our threshold of 16 bytes, and triggers the lint. Satisfying the lint doesn't make sense in the larger picture though, becauseFoo
is still 24 bytes in the 64-bit world.I ran into this issue in practice when adding our lint set to SimpleCSS.
Unfortunately our custom
trivial-copy-size-limit
can't be a multiplier oftarget_pointer_width
even though the default value does that. So the solution is to make the lint apply only when targeting 64-bit. Can't do that inCargo.toml
solib.rs
it is. Luckily we don't care as much about this lint in the examples so it works out fine.